package com.tywj.panda.customer.common.entity

import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName

/**
 * 选中的商品信息(订单详情中的日期信息)
 */
class SelectedPriceDateEntity() : Parcelable {
    /**
     * 车牌号
     */
    @SerializedName("vehicle_no")
    var vehicleNo = ""

    /**
     * 票号
     */
    @SerializedName("ticket_code")
    var ticketCode = ""

    /**
     * 商品日期（乘车日期、获取详情中的日期）
     */
    @SerializedName("line_date")
    var lineDate = ""

    //下单时的选择的日期
    var date = ""

    //商品编号（下单时使用）
    @SerializedName("goods_no")
    var goodsNo = ""

    //单价
    var price = 0

    //退款数量
    @SerializedName("refund_number")
    var refundNumber = 0

    var number = 0

    //车票状态：(已过期、已使用、未使用、已退款、已转让（预留、未配车 、已配车)

    var status = 0

    //获取系统时间
    var dateTime = java.util.Date()

    /*********************************新增字段*******************************/
    //是否已使用
    var isUsed = false

    //是否已退款
    var isRefunded = false

    //车票转让时选中
    var isSelected = false

    //是否是同一天的日历信息
    var isSameDay = false

    //如果为今天显示颜色为蓝色
    var isToday = false

    constructor(parcel: Parcel) : this() {
        vehicleNo = parcel.readString() ?: ""
        ticketCode = parcel.readString() ?: ""
        lineDate = parcel.readString() ?: ""
        date = parcel.readString() ?: ""
        goodsNo = parcel.readString() ?: ""
        price = parcel.readInt()
        refundNumber = parcel.readInt()
        number = parcel.readInt()
        status = parcel.readInt()
        isUsed = parcel.readByte() != 0.toByte()
        isRefunded = parcel.readByte() != 0.toByte()
        isSelected = parcel.readByte() != 0.toByte()
        isSameDay = parcel.readByte() != 0.toByte()
        isToday = parcel.readByte() != 0.toByte()
    }


    override fun writeToParcel(dest: Parcel, flags: Int) {
        dest.writeString(vehicleNo)
        dest.writeString(ticketCode)
        dest.writeString(lineDate)
        dest.writeString(date)
        dest.writeString(goodsNo)
        dest.writeInt(price)
        dest.writeInt(refundNumber)
        dest.writeInt(number)
        dest.writeInt(status)
    }

    override fun describeContents(): Int = 0

    override fun toString(): String {
        return "SelectedPriceDateEntity(vehicleNo='$vehicleNo', ticketCode='$ticketCode', busDate='$lineDate', date='$date', goodsNo='$goodsNo', price=$price, refundNumber=$refundNumber, number=$number, status=$status, dateTime=$dateTime, isUsed=$isUsed, isRefunded=$isRefunded, isSelected=$isSelected, isSameDay=$isSameDay, isToday=$isToday)"
    }

    companion object CREATOR : Parcelable.Creator<SelectedPriceDateEntity> {
        override fun createFromParcel(parcel: Parcel): SelectedPriceDateEntity {
            return SelectedPriceDateEntity(parcel)
        }

        override fun newArray(size: Int): Array<SelectedPriceDateEntity?> {
            return arrayOfNulls(size)
        }
    }


}